require('./Areachart.less');
import ReactHighcharts from 'react-highcharts';

class Areachart extends React.Component {

    constructor(props) {
        super(props);
        this.state = {
        };
    }

    config() {
        let { data } = this.props;
        return {
            chart: {
                type: 'area',
                height: 200
            },
            title: {
                text: ''
            },
            xAxis: {
                categories: data.xAxis
            },
            yAxis: {
                title: {
                    text: data.xText,
                    align: 'high',
                    rotation: 0
                },
                labels: {
                    formatter: function () {
                        return this.value + '%';
                    }
                }
            },
            tooltip: {
                pointFormat: '间隔率 <b>{point.y:,.0f}</b>'
            },
            credits: {
                enabled: false
            },
            plotOptions: {
                series: {
                    allowPointSelect: true
                }
            },
            series: data.yAxis
        }
    }


    render() {
        let me = this;
        return (
            <div className="areachart">
                <ReactHighcharts config={this.config()} />
            </div>
        );
    }

    componentWillMount() {
    }

    componentDidMount() {
    }

    componentWillReceiveProps(nextProps) {
    }

    shouldComponentUpdate(nextProps, nextState) {
        return true;
    }

    componentWillUpdate(nextProps, nextState) {
    }

    componentDidUpdate(prevProps, prevState) {
    }

    componentWillUnmount() {
    }
}

module.exports = Areachart;
